# -*- coding: utf-8 -*-
import time
from selenium import webdriver
import unittest
import xlrd
from Page.loginPage import loginPage
from publicModule.login import login
from Page.branchuwPage import branchuwPage
from publicModule.branchuw import branchuw

class Test_BranchUw(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        print('开始测试')
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(10)
        self.driver.maximize_window()
        self.driver.get("http://10.22.26.34:8080/fwd/indexlis.jsp")
        time.sleep(2)

        self.loginPage = loginPage(self.driver)
        self.login = login(self.driver)
        self.branchuwPage=branchuwPage(self.driver)
        self.branchuw=branchuw(self.driver)
 # @classmethod
    # def tearDownClass(self):
    #     print('结束测试')
    #     self.driver.quit()
    def test01(self):
        print('test01')
        filename='..//TestData//loginData.xlsx'
        excel_open=xlrd.open_workbook(filename)
        table=excel_open.sheet_by_name('Sheet1')
        rows=table.nrows
        for i in range(2,rows):
            row_content=table.row_values(i)
            username=row_content[0]
            password=row_content[1]
            orgcode=row_content[2]
            login.login(self,username,password,orgcode)
    def test02(self):
        branchuw.GrpInsurance(self)
        time.sleep(1)
        branchuw.InquiryManager(self)
        time.sleep(1)
        branchuw.BranchUw(self)
        time.sleep(1)
    def test03(self):
        filename = '..//TestData//customerAdd.xlsx'
        excel_open = xlrd.open_workbook(filename)
        table = excel_open.sheet_by_name('Sheet1')
        rows = table.nrows
        for i in range(2, rows):
            row_content = table.row_values(i)
            QuotName = row_content[0]
            BranchUWOpinion = row_content[24]
            BranchUWConclu = row_content[25]
            branchuw.publictopersonal(self,QuotName,BranchUWOpinion,BranchUWConclu)
    def test04(self):
        filename = '..//TestData//customerAdd.xlsx'
        excel_open = xlrd.open_workbook(filename)
        table = excel_open.sheet_by_name('Sheet1')
        rows = table.nrows
        for i in range(2, rows):
            row_content = table.row_values(i)
            FPreCustomerName = row_content[0]
            branchuw.quote(self, FPreCustomerName)
    # 选择报价计划
    def test05(self):
        branchuw.CheckQuotPlan(self)
    def test06(self):
        filename = '..//TestData//customerAdd.xlsx'
        excel_open = xlrd.open_workbook(filename)
        table = excel_open.sheet_by_name('Sheet1')
        rows = table.nrows
        for i in range(2, rows):
            row_content = table.row_values(i)
            preCustomerName = row_content[0]
            branchuw.ApplicationPrint(self,preCustomerName)
        branchuw.ApplicationNo(self)




